#{extends 'main.html' /}
#{set title:'Home' /}

#{if post}
	<div class="messages">
		
		<div class="messageforum">
			<div class="auteurmessageforum">
				<a href="@{Application.viewProfile(post.user.id)}">${post.user.login}</a>
			</div>
			<div class="textmessageforum">
				${post.titre}
			</div>
			<div class="textmessageforum">
				${post.message}
			</div>
		</div>
	</div>

	#{if reponses}
		
		<div class="messages">
			#{list items:reponses, as:'reponse'}
			<div class="messageforum">
				<div class="auteurmessageforum">
					<a href="@{Application.viewProfile(reponse.user.id)}">${reponse.user.login}</a>
				</div>
				<div class="textmessageforum">
					${reponse.message}
				</div>
			</div>
			#{/list}
		</div>
	#{/if}

	#{if session.get("isConnected")}
	<div id="reponseforum">

	R&eacute;pondre :<br />
	#{form @Application.repondre()}
	<input type="hidden" name="topic" id="topic" value="${post}" />
	<input type="hidden" name="user" id="user" value='${session.get("id")}' />
	<textarea name="reponse" id="reponse" align="center" rows="20" cols="60"> 	</textarea>
	<input type="submit" value="Envoyer" />
	#{/form}
	</div>
	#{/if}

#{/if}